<?php
include "../tambah/date.php";
$per_page=2;
include_once('../Connections/sepolwan_connect.php');
if(isset($_POST['pageLimit']) && !empty($_POST['pageLimit'])){
    $pageLimit=$_POST['pageLimit'];
}else{
    $pageLimit='0';
}
$pageLimit=$pageLimit;
	mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_tl_user = "SELECT * FROM dinding_tl ORDER BY id DESC limit ".$pageLimit.",".$per_page;
$tl_user = mysql_query($query_tl_user, $sepolwan_connect) or die(mysql_error());
$row_tl_user = mysql_fetch_assoc($tl_user);
$totalRows_tl_user = mysql_num_rows($tl_user);

	 if ($totalRows_tl_user > 0) { // Show if recordset not empty ?>
  <?php do { ?>
    <p><strong><?php echo $row_tl_user['judul']; 
	mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_mm = "SELECT * FROM memberdb WHERE id=".$row_tl_user['me']." ";
$mm = mysql_query($query_mm, $sepolwan_connect) or die(mysql_error());
$row_mm = mysql_fetch_assoc($mm);
$totalRows_mm = mysql_num_rows($mm);
	?></strong>
  <p> 
  <a href="../<?php echo $row_mm['nama_user'] ?>" target="_parent"><img src="../images/member/ava/<?php echo $row_mm['foto_profile'] ?>" width="60" height="60" style="float:left; border:1px solid #CCC; margin-right:10px; margin-bottom:10px" /></a> <font style="text-justify: auto"><?php 
  
  
  if (strlen($row_tl_user['isi'])<=255) {
	  
		//echo $konten = str_replace(array("\r\n","\r","\n", "[img]", "[/img]", "[a]", "[/a]"), array("<br/>","<br/>","<br/>","<img src='","' style='max-width:500px' />", "<a href='", "' target='_blank'>&gt;&gt; Klik Disini &lt;&lt;</a>" ),$row_tl_user['isi']);// 
		echo
preg_replace('~@([^\s#@]+)~','<a href="http://geriloji.com/\1" target="_parent">$0</a>',
	str_replace(array("\r\n","\r","\n"), "<br />",
    preg_replace('~!([^\s#@]+)~','<img src="\1" style="max-width:500px"/>',
	preg_replace('~%([^\s#@]+)~','<a href="\1" target="_blank">\1</a>',
	preg_replace('~#([^\s#@]+)~','<a href="search/\1">$0</a>', $row_tl_user['isi'])))));
		
		
  } else if  (strlen($row_tl_user['isi'])>255) {
		
		
	  	echo substr($row_tl_user['isi'], 0, 350);
		echo " <font size='-3'><a href='../".$row_mm['nama_user']."/artikel/".$row_tl_user['id']."-".str_replace(array(' ', '`', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '{', '}', '|', ',', ':', ';', '"', '<', '>', ',', '.', '?', '/'), '-', $row_tl_user['judul'])."post.html' target='_parent' >Selengkapnya&gt;&gt;</a></font>"; 
  }
  
  
   ?></font></p>
  <font size="-5" color="#999999"><?php echo tgl_indo($row_tl_user['waktu']), substr($row_tl_user['waktu'], 10, 6), " WIB"; ?></font> <font size="-5" color="#999999"><a href="../<?php  if ($row_tl_user['judul']<>"") {  
	echo $row_mm['nama_user']."/artikel/".$row_tl_user['id']."-".str_replace(array(' ', '`', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '{', '}', '|', ',', ':', ';', '"', '<', '>', ',', '.', '?', '/'), '-', $row_tl_user['judul']); 
	} else {
		echo $row_mm['nama_user']."/artikel/".$row_tl_user['id']."-post";
	}?>.html" target="_parent">Lihat Detail</a> </font></p>
    
     
    
    <div style="width:100%; height:1px; background:#CCC; margin-top:20px"></div>
    <?php
	
		mysql_free_result($mm);
	 } while ($row_tl_user = mysql_fetch_array($tl_user)); ?>
  <?php
$loadCount=$pageLimit+$per_page;
 if($totalRows_tl_user >= $per_page){ ?>
       <div class="load_more_link">
       <input type="button" class="button" value="Load More" 
       onclick=loadData(<?php echo $loadCount ?>)>
       <span class="flash"></span></div> <?php
 }
}else{
       echo 'No Data Found';
}
  
mysql_free_result($tl_user);
?>